﻿using System;

namespace BizElements.BusinessLayer
{
    #region Documentation.
    /// <summary>
    /// Provides a generic utility class that is used to store two related objects. 
    /// </summary>
    /// <typeparam name="T1">Type of the first object of the pair.</typeparam>
    /// <typeparam name="T2">Type of the second object of the pair.</typeparam>
    /// <remarks>The <b>Pair</b> class is used as a basic structure to store two related objects. You can use the 
    /// Pair class in your own code anywhere that you need a structure to contain two related objects.</remarks>
    #endregion
    [Serializable]
    public sealed class Pair<T1, T2>
    {
        #region Fields.

        /// <summary>
        /// Gets or sets the first object of the pair.
        /// </summary>
        T1 first;

        /// <summary>
        /// Gets or sets the second object of the pair.
        /// </summary>
        T2 second;

        #endregion

        #region Constructors.

        /// <summary>
        /// Creates a new, uninitialized instance of the <b>Pair</b> class.
        /// </summary>
        public Pair()
        { }

        /// <summary>
        /// Initializes a new instance of the <b>Pair</b> class, using the specified object pair.
        /// </summary>
        /// <param name="first">Object assigned to <see cref="First"/>.</param>
        /// <param name="second">Object assigned to <see cref="Second"/>.</param>
        public Pair(T1 first, T2 second)
        {
            this.first = first;
            this.second = second;
        }

        #endregion

        #region Properties.

        /// <summary>
        /// Gets or sets the first object of the pair.
        /// </summary>
        public T1 First
        {
            get { return this.first; }
            set { this.first = value; }
        }

        /// <summary>
        /// Gets or sets the second object of the pair.
        /// </summary>
        public T2 Second
        {
            get { return this.second; }
            set { this.second = value; }
        }

        #endregion
    }
}